package com.ruoyi.web.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.web.mapper.UserOrderDetailMapper;
import com.ruoyi.web.domain.UserOrderDetail;
import com.ruoyi.web.service.IUserOrderDetailService;

/**
 * 销售详情Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-11
 */
@Service
public class UserOrderDetailServiceImpl implements IUserOrderDetailService 
{
    @Autowired
    private UserOrderDetailMapper userOrderDetailMapper;

    /**
     * 查询销售详情
     * 
     * @param id 销售详情主键
     * @return 销售详情
     */
    @Override
    public UserOrderDetail selectUserOrderDetailById(Long id)
    {
        return userOrderDetailMapper.selectUserOrderDetailById(id);
    }

    /**
     * 查询销售详情列表
     * 
     * @param userOrderDetail 销售详情
     * @return 销售详情
     */
    @Override
    public List<UserOrderDetail> selectUserOrderDetailList(UserOrderDetail userOrderDetail)
    {
        return userOrderDetailMapper.selectUserOrderDetailList(userOrderDetail);
    }

    /**
     * 新增销售详情
     * 
     * @param userOrderDetail 销售详情
     * @return 结果
     */
    @Override
    public int insertUserOrderDetail(UserOrderDetail userOrderDetail)
    {
        userOrderDetail.setCreateTime(DateUtils.getNowDate());
        return userOrderDetailMapper.insertUserOrderDetail(userOrderDetail);
    }

    /**
     * 修改销售详情
     * 
     * @param userOrderDetail 销售详情
     * @return 结果
     */
    @Override
    public int updateUserOrderDetail(UserOrderDetail userOrderDetail)
    {
        userOrderDetail.setUpdateTime(DateUtils.getNowDate());
        return userOrderDetailMapper.updateUserOrderDetail(userOrderDetail);
    }

    /**
     * 批量删除销售详情
     * 
     * @param ids 需要删除的销售详情主键
     * @return 结果
     */
    @Override
    public int deleteUserOrderDetailByIds(Long[] ids)
    {
        return userOrderDetailMapper.deleteUserOrderDetailByIds(ids);
    }

    /**
     * 删除销售详情信息
     * 
     * @param id 销售详情主键
     * @return 结果
     */
    @Override
    public int deleteUserOrderDetailById(Long id)
    {
        return userOrderDetailMapper.deleteUserOrderDetailById(id);
    }

    /**
     * 根据订单id删除销售详情
     * 
     * @param orderId 订单id
     * @return 结果
     */
    @Override   
    public int deleteUserOrderDetailByOrderId(Long orderId)
    {
        return userOrderDetailMapper.deleteUserOrderDetailByOrderId(orderId);
    }

    /**
     * 根据订单id批量删除销售详情
     * 
     * @param orderIds 订单id集合
     * @return 结果
     */
    @Override   
    public int deleteUserOrderDetailByOrderIds(Long[] orderIds)
    {
        return userOrderDetailMapper.deleteUserOrderDetailByOrderIds(orderIds);
    }

    /**
     * 根据订单id查询销售详情
     * 
     * @param orderIds 订单id集合
     * @return 销售详情集合
     */
    @Override
    public List<UserOrderDetail> selectUserOrderDetailByOrderIds(Long[] orderIds)
    {
        return userOrderDetailMapper.selectUserOrderDetailByOrderIds(orderIds);
    }
}
